package com.cyz.repository;


import java.util.Collection;
import java.util.Date;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.rest.core.annotation.RestResource;

import com.vsd.domain.Coupon;

@RestResource(exported = false)
public interface CouponRepository extends CrudRepository<Coupon, String> {

	Page<Coupon> findBySourceAndBeginTimeBeforeAndEndTimeAfter(Integer resource,Date beginTime,Date endTime,Pageable p);
	
	Page<Coupon> findByStoreIdAndSource(String id,Integer source,Pageable p);
	
	Collection<Coupon> findBySourceAndBeginTimeBeforeAndEndTimeAfterAndTotalGreaterThan(Integer resource,Date beginTime,Date endTime,Integer total,Sort sort);
	
	Page<Coupon> findAll(Pageable p);
}
